package cn.ikun.mf.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class AppjdbcSelect {
    public static void main(String[] args) throws Exception {
        Class.forName("com.mysql.jdbc.Driver");
        String url = "jdbc:mysql://localhost:3306/test?useSSL=false";
        String username = "root";
        String password = "5240";

        Connection connection = DriverManager.getConnection(url, username, password);

        Statement statement = connection.createStatement();

        String aql = "Select id,username From`user`";
        ResultSet set = statement.executeQuery(aql);
        while (set.next())
        {
            long id = set.getLong(1);
            String name = set.getString(2);
            System.out.println("id=" + id + ",name=" + name);
        }
    }
    }

